package pers.ree.demo.base;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class SubDemo extends ThisDemo {

    public static void main(String[] args) {
        ThisDemo thisDemo = new ThisDemo();
        thisDemo.print();

        SubDemo subDemo = new SubDemo();
        Class c = ThisDemo.class;
        try {
            Method m = c.getDeclaredMethod("print");
            m.invoke(subDemo);
        } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
            e.printStackTrace();
        }

        subDemo.print();
    }

    /**
     * 不能覆盖父类的final方法
     */
//    public void fm() {
//
//    }
}
